<?php

namespace App\Repositories\Distribution;

use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\Distribution\DistributionModeRepository;
use App\Models\Distribution\DistributionMode;
use App\Validators\Distribution\DistributionModeValidator;

/**
 * Class DistributionModeRepositoryEloquent.
 *
 * @package namespace App\Repositories\Distribution;
 */
class DistributionModeRepositoryEloquent extends BaseRepository implements DistributionModeRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return DistributionMode::class;
    }

    /**
    * Specify Validator class name
    *
    * @return mixed
    */
    public function validator()
    {

        return DistributionModeValidator::class;
    }


    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    /**
     * 配送方式
     * @author Min
     * @param $mode_id
     * @return mixed 0 ：当日达  1：次日达
     */
    public function getDistributionModeArrivalType($mode_id)
    {
        $data = $this->find($mode_id, ['arrival_type']);
        return $data['arrival_type'];
    }
    
}
